

function buildMyTableOptions (tableid, url, dataSource) {
    this.tableid = tableid;
    this.url = url;
    this.dataSource = dataSource;
    this.columns = [];
    this.addDataColumn = function(name, dataColumn) {
        this.columns.push({dataColumn: dataColumn, name: name, type:"data"});
    };
    this.addEditColumn = function(className, defaultContent) {
        this.columns.push({className: className, defaultContent: defaultContent, type:"edit"});
    };
    this.addDeleteColumn = function(className, defaultContent) {
        this.columns.push({className: className, defaultContent: defaultContent, type:"delete"});
    };
    this.addExpandColumn = function(className, defaultContent) {
        this.columns.push({className: className, defaultContent: defaultContent, type:"expand"});
    };
}

function buildMyTable(options) {
    
}





/*
$(document).ready(function () {
    var table = $('#table_id').DataTable({
        ajax: {
            url: "/Trabalho_PD/webresources/WebServiceBoleias/testes",
            type: "GET",
            dataSrc: "testes"
        },
        columns: [
            {
                "className": 'details-control',
                "orderable": false,
                "data": null,
                "defaultContent": 'Abrir'
            },
            {
                "className": 'edit-control',
                "orderable": false,
                "data": null,
                "defaultContent": 'Editar'
            },
            {
                "className": 'delete-control',
                "orderable": false,
                "data": null,
                "defaultContent": 'Eliminar'
            },
            {data: 'name'},
            {data: 'age'},
            {data: 'address'}
        ]

    });

    // Add event listener for opening and closing details
    $('#table_id tbody').on('click', 'td.details-control', function () {
        var tr = $(this).closest('tr');
        var row = table.row(tr);

        if (row.child.isShown()) {
            // This row is already open - close it
            row.child.hide();
            tr.removeClass('shown');
        }
        else {
            // Open this row
            row.child(format(row.data())).show();
            tr.addClass('shown');
        }
    });

    // Add event listener for opening and closing details
    $('#table_id tbody').on('click', 'td.edit-control', function () {
        var tr = $(this).closest('tr');
        var row = table.row(tr);

        if (row.child.isShown()) {
            // This row is already open - close it
            row.child.hide();
            tr.removeClass('shown');
        }
        else {
            // Open this row
            row.child(format2(row.data())).show();
            tr.addClass('shown');
        }
    });

});*/

/* Formatting function for row details - modify as you need */
function format(d) {
    // `d` is the original data object for the row
    return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
            '<tr>' +
            '<td>Full name:</td>' +
            '<td>' + d.name + '</td>' +
            '</tr>' +
            '<tr>' +
            '<td>Age:</td>' +
            '<td>' + d.age + '</td>' +
            '</tr>' +
            '<tr>' +
            '<td>Extra info:</td>' +
            '<td>And any further details here (images etc)...</td>' +
            '</tr>' +
            '</table>';
}

/* Formatting function for row details - modify as you need */
function format2(d) {
    // `d` is the original data object for the row
    return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">' +
            '<tr>' +
            '<td>Full name:</td>' +
            '<td><input id="row-1-age" name="row-1-age" value="' + d.name + '" type="text"></td>' +
            '</tr>' +
            '<tr>' +
            '<td>Age:</td>' +
            '<td>' + d.age + '</td>' +
            '</tr>' +
            '<tr>' +
            '<td>Extra info:</td>' +
            '<td>And any further details here (images etc)...</td>' +
            '</tr>' +
            '</table>';
}